home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / mush-7.1.1 / panels.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-05-02  |  14.8 KB  |  502 lines

  1. /* @(#)panel.c    (c) copyright    10/18/86 (Dan Heller) */
  2. /* @(#)panels.c    (c) copyright    9/29/89 (Dan Heller) */
  3.  
  4. #include "mush.h"
  5. /* mouse symbols */
  6. short dat_mouse_left[] = {
  7.     0x1FF8, 0x3FFC, 0x336C, 0x336C, 0x336C, 0x336C, 0x336C, 0x336C, 
  8.     0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FC4, 0x3FFC, 0x1FF8
  9. };
  10.  
  11. short dat_mouse_middle[] = {
  12.     0x1FF8, 0x3FFC, 0x366C, 0x366C, 0x366C, 0x366C, 0x366C, 0x366C, 
  13.     0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FC4, 0x3FFC, 0x1FF8
  14. };
  15.  
  16. short dat_mouse_right[] = {
  17.     0x1FF8, 0x3FFC, 0x36CC, 0x36CC, 0x36CC, 0x36CC, 0x36CC, 0x36CC, 
  18.     0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FFC, 0x3FC4, 0x3FFC, 0x1FF8
  19. };
  20.  
  21. mpr_static(mouse_left,      16, 16, 1, dat_mouse_left);
  22. mpr_static(mouse_middle,    16, 16, 1, dat_mouse_middle);
  23. mpr_static(mouse_right,     16, 16, 1, dat_mouse_right);
  24.  
  25. Panel_item
  26.     folder_item,    /* change folders */
  27.     folder_text_item,    /* text item for the folder item */
  28.     file_item,         /* text item for the save item */
  29.     msg_num_item,    /* text item explicitly states which message to read */
  30.     read_item,        /* read the current message */
  31.     save_item,        /* saves messages */
  32.     sub_hdr_item[6];    /* display items that just sit there and give help */
  33.  
  34. /* These global panel items for letter composition should eventually go away */
  35. Panel_item
  36.     edit_item,        /* edit a message */
  37.     reply_item;        /* reply button -- also called from hdr_sw menu */
  38.  
  39. extern void
  40.     close_frame(), do_options(), do_compose(), do_send(), do_sort(),
  41.     do_edit(), delete_mail(), respond_mail(), do_help(), do_lpr(),
  42.     do_update(), abort_mail(), do_include(), load_from_file(),
  43.     save_to_file(), tilde_from_menu(), fkey_interposer();
  44.  
  45. extern Panel_setting
  46.     msg_num_done(), file_dir();
  47.  
  48. Panel
  49. make_hdr_panel(parent, choice_args, button_args)
  50. Frame parent;
  51. char **choice_args, **button_args;
  52. {
  53.     Panel panel = window_create(parent, PANEL,
  54.     WIN_CONSUME_KBD_EVENTS,
  55.         WIN_LEFT_KEYS, WIN_TOP_KEYS, WIN_RIGHT_KEYS, NULL,
  56.     NULL);
  57.     (void) notify_interpose_event_func(panel, fkey_interposer, NOTIFY_SAFE);
  58.  
  59.     (void) panel_create_item(panel, PANEL_CHOICE,
  60.     PANEL_ATTRIBUTE_LIST,         choice_args,
  61.     PANEL_LABEL_IMAGE,
  62.         panel_button_image(panel, "Done", 4, mush_font),
  63.     PANEL_CHOICE_STRINGS,
  64.         "Close to Icon", "Quit Tool", "Help", NULL,
  65.     PANEL_NOTIFY_PROC,         toolquit,
  66.     NULL);
  67.  
  68.     (void) panel_create_item(panel, PANEL_CHOICE,
  69.     PANEL_ATTRIBUTE_LIST,         choice_args,
  70.     PANEL_LABEL_IMAGE,
  71.         panel_button_image(panel, "Help", 4, mush_font),
  72.     PANEL_CHOICE_STRINGS,
  73.         "General", "Help with \"help\"", "The Mouse", "Windows",
  74.         "Message headers", "Message lists", "Folders", NULL,
  75.     PANEL_NOTIFY_PROC,         do_help,
  76.     NULL);
  77.  
  78.     folder_item = panel_create_item(panel, PANEL_CHOICE,
  79.     PANEL_ATTRIBUTE_LIST,         choice_args,
  80.     PANEL_LABEL_IMAGE,
  81.         panel_button_image(panel, "Folder", 6, mush_font),
  82.     PANEL_CHOICE_STRINGS,
  83.         "System Mailbox", "Main Mailbox", "Last Accessed Folder", NULL,
  84.     PANEL_NOTIFY_PROC,         do_file_dir,
  85.     NULL);
  86.  
  87.     add_folder_to_menu(folder_item, 3);
  88.  
  89.     folder_text_item = panel_create_item(panel, PANEL_TEXT,
  90.     PANEL_ATTRIBUTE_LIST,         choice_args,
  91.     PANEL_LABEL_FONT,         mush_font,
  92.     PANEL_LABEL_STRING,        "Filename:",
  93.     PANEL_VALUE_DISPLAY_LENGTH,     28,
  94.     PANEL_NOTIFY_STRING,         "\n\r\033",
  95.     PANEL_NOTIFY_PROC,         file_dir,
  96.     NULL);
  97.  
  98.     (void) panel_create_item(panel, PANEL_CHOICE,
  99.     PANEL_ATTRIBUTE_LIST,         choice_args,
  100.     PANEL_LABEL_IMAGE,
  101.         panel_button_image(panel, "Update", 6, mush_font),
  102.     PANEL_CHOICE_STRINGS,         "New Mail", "Help", NULL,
  103.     PANEL_NOTIFY_PROC,         do_update,
  104.     NULL);
  105.  
  106.     (void) panel_create_item(panel, PANEL_CHOICE,
  107.     PANEL_ATTRIBUTE_LIST,         choice_args,
  108.     PANEL_LABEL_IMAGE,
  109.         panel_button_image(panel, "Options", 7, mush_font),
  110.     PANEL_CHOICE_STRINGS,        "Variables", "Headers", "Aliases", NULL,
  111.     PANEL_NOTIFY_PROC,         do_options,
  112.     NULL);
  113.  
  114.     msg_num_item = panel_create_item(panel, PANEL_TEXT,
  115.     PANEL_ATTRIBUTE_LIST,        choice_args,
  116.     PANEL_LABEL_STRING,        "Range:",
  117.     PANEL_MENU_CHOICE_STRINGS,     "Help", NULL,
  118.     PANEL_VALUE_DISPLAY_LENGTH,     17,
  119.     PANEL_VALUE_STORED_LENGTH,     80,
  120.     PANEL_LABEL_FONT,         mush_font,
  121.     PANEL_NOTIFY_STRING,         "\n\r",
  122.     PANEL_NOTIFY_PROC,         msg_num_done,
  123.     NULL);
  124.  
  125.     sub_hdr_item[0] = panel_create_item(panel, PANEL_CHOICE,
  126.     PANEL_ATTRIBUTE_LIST,         choice_args,
  127.     PANEL_LABEL_IMAGE,            &mouse_left,
  128.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  129.     PANEL_NOTIFY_PROC,            read_mail,
  130.     NULL);
  131.     sub_hdr_item[1] = panel_create_item(panel, PANEL_CHOICE,
  132.     PANEL_ATTRIBUTE_LIST,         choice_args,
  133.     PANEL_LABEL_STRING,           "Read ",
  134.     PANEL_MENU_TITLE_IMAGE,     &mouse_left,
  135.     PANEL_CHOICE_STRINGS,        "Help", NULL,
  136.     PANEL_NOTIFY_PROC,            read_mail,
  137.     NULL);
  138.     sub_hdr_item[2] = panel_create_item(panel, PANEL_CHOICE,
  139.     PANEL_ATTRIBUTE_LIST,         choice_args,
  140.     PANEL_LABEL_IMAGE,            &mouse_middle,
  141.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  142.     PANEL_NOTIFY_PROC,            delete_mail,
  143.     NULL);
  144.     sub_hdr_item[3] = panel_create_item(panel, PANEL_CHOICE,
  145.     PANEL_ATTRIBUTE_LIST,         choice_args,
  146.     PANEL_LABEL_STRING,           "Delete ",
  147.     PANEL_MENU_TITLE_IMAGE,     &mouse_middle,
  148.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  149.     PANEL_NOTIFY_PROC,            delete_mail,
  150.     NULL);
  151.     sub_hdr_item[4] = panel_create_item(panel, PANEL_CHOICE,
  152.     PANEL_ATTRIBUTE_LIST,         choice_args,
  153.     PANEL_LABEL_IMAGE,            &mouse_right,
  154.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  155.     PANEL_NOTIFY_PROC,            read_mail,
  156.     NULL);
  157.     sub_hdr_item[5] = panel_create_item(panel, PANEL_CHOICE,
  158.     PANEL_ATTRIBUTE_LIST,         choice_args,
  159.     PANEL_LABEL_STRING,           "Menu         ",
  160.     PANEL_MENU_TITLE_IMAGE,            &mouse_right,
  161.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  162.     PANEL_NOTIFY_PROC,            read_mail,
  163.     NULL);
  164.  
  165.     (void) panel_create_item(panel, PANEL_CHOICE,
  166.     PANEL_ATTRIBUTE_LIST,         choice_args,
  167.     PANEL_LABEL_IMAGE,
  168.         panel_button_image(panel, "Printer", 7, mush_font),
  169.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  170.     PANEL_NOTIFY_PROC,         do_lpr,
  171.     NULL);
  172.  
  173.     (void) panel_create_item(panel, PANEL_CHOICE,
  174.     PANEL_ATTRIBUTE_LIST,         choice_args,
  175.     PANEL_LABEL_IMAGE,
  176.         panel_button_image(panel, "Sort", 4, mush_font),
  177.     PANEL_CHOICE_STRINGS,
  178.         "By Date", "By Author", "By Size", "By Subject",
  179.         "By Subject (ignore Re:)", "By Status", "Help", NULL,
  180.     PANEL_NOTIFY_PROC,         do_sort,
  181.     NULL);
  182.  
  183.     window_fit_height(panel);
  184.     return panel;
  185. }
  186.  
  187. Panel
  188. make_main_panel(parent, choice_args, button_args)
  189. Frame parent;
  190. char **choice_args, **button_args;
  191. {
  192.     /* main panel stuff: */
  193.     Panel panel = window_create(parent, PANEL,
  194.     WIN_CONSUME_KBD_EVENTS,
  195.         WIN_LEFT_KEYS, WIN_TOP_KEYS, WIN_RIGHT_KEYS, NULL,
  196.     NULL);
  197.     (void) notify_interpose_event_func(panel, fkey_interposer, NOTIFY_SAFE);
  198.  
  199.     read_item = panel_create_item(panel, PANEL_CHOICE,
  200.     PANEL_ATTRIBUTE_LIST,         choice_args,
  201.     PANEL_LABEL_IMAGE,
  202.         panel_button_image(panel, "Next", 4, mush_font),
  203.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  204.     PANEL_NOTIFY_PROC,         read_mail,
  205.     NULL);
  206.  
  207.     (void) panel_create_item(panel, PANEL_CHOICE,
  208.     PANEL_ATTRIBUTE_LIST,         choice_args,
  209.     PANEL_LABEL_IMAGE,
  210.         panel_button_image(panel, "Delete", 6, mush_font),
  211.     PANEL_CHOICE_STRINGS,         "Delete",
  212.                     "Undelete",
  213.                     "Help", NULL,
  214.     PANEL_NOTIFY_PROC,         delete_mail,
  215.     NULL);
  216.  
  217.     {
  218.     char *mbox = do_set(set_options, "mbox");
  219.     if (!mbox || !*mbox)
  220.         mbox = DEF_MBOX;
  221.     save_item = panel_create_item(panel, PANEL_CHOICE,
  222.         PANEL_ATTRIBUTE_LIST,     choice_args,
  223.         PANEL_LABEL_IMAGE, panel_button_image(panel, "Save", 4, mush_font),
  224.         PANEL_CHOICE_STRINGS,     trim_filename(mbox), NULL,
  225.         PANEL_NOTIFY_PROC,         do_file_dir,
  226.         NULL);
  227.     }
  228.  
  229.     add_folder_to_menu(save_item, 1);
  230.  
  231.     file_item = panel_create_item(panel, PANEL_TEXT,
  232.     PANEL_ATTRIBUTE_LIST,         choice_args,
  233.     PANEL_LABEL_FONT,         mush_font,
  234.     PANEL_SHOW_MENU,        TRUE,
  235.     PANEL_LABEL_STRING,         "Filename:",
  236.     PANEL_MENU_CHOICE_STRINGS,    "Save message without message header",
  237.                     NULL,
  238.     PANEL_VALUE_DISPLAY_LENGTH,     28,
  239.     PANEL_NOTIFY_STRING,         "\n\r\033",
  240.     PANEL_NOTIFY_PROC,         file_dir,
  241.     NULL);
  242.  
  243.     (void) panel_create_item(panel, PANEL_CHOICE,
  244.     PANEL_ATTRIBUTE_LIST,         choice_args,
  245.     PANEL_LABEL_IMAGE,
  246.         panel_button_image(panel, "Compose", 7, mush_font),
  247.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  248.     PANEL_NOTIFY_PROC,        do_compose,
  249.     NULL);
  250.  
  251.     reply_item = panel_create_item(panel, PANEL_CHOICE,
  252.     PANEL_ATTRIBUTE_LIST,         choice_args,
  253.     PANEL_LABEL_IMAGE,
  254.         panel_button_image(panel, "Reply", 5, mush_font),
  255.     PANEL_CHOICE_STRINGS,
  256.         "Sender Only", "Sender Only (include msg)",
  257.         "All Recipients", "All Recipients (include msg)", "Help", NULL,
  258.     PANEL_NOTIFY_PROC,         respond_mail,
  259.     NULL);
  260.  
  261.     window_fit_height(panel);
  262.     return panel;
  263. }
  264.  
  265. Panel
  266. make_compose_panel(parent, choice_args, button_args)
  267. Frame parent;
  268. char **choice_args, **button_args;
  269. {
  270.     Panel panel = window_create(parent, PANEL, NULL);
  271.     Panel_item filename_item, fortune_item, sign_item, send_item;
  272.  
  273.     (void) notify_interpose_event_func(panel, fkey_interposer, NOTIFY_SAFE);
  274.  
  275.     (void) panel_create_item(panel, PANEL_BUTTON,
  276.     PANEL_ATTRIBUTE_LIST,         button_args,
  277.     PANEL_LABEL_IMAGE,
  278.         panel_button_image(panel, "Close", 5, mush_font),
  279.     PANEL_NOTIFY_PROC,         close_frame,
  280.     NULL);
  281.  
  282.     (void) panel_create_item(panel, PANEL_CHOICE,
  283.     PANEL_ATTRIBUTE_LIST,         choice_args,
  284.     PANEL_LABEL_IMAGE,
  285.         panel_button_image(panel, "Compose", 7, mush_font),
  286.     PANEL_CHOICE_STRINGS,         "Help", NULL,
  287.     PANEL_NOTIFY_PROC,         do_compose,
  288.     NULL);
  289.  
  290.     send_item = panel_create_item(panel, PANEL_BUTTON,
  291.     PANEL_ATTRIBUTE_LIST,         button_args,
  292.     PANEL_SHOW_ITEM,         FALSE,
  293.     PANEL_LABEL_IMAGE,
  294.         panel_button_image(panel, "Send", 4, mush_font),
  295.     PANEL_NOTIFY_PROC,         do_send,
  296.     NULL);
  297.  
  298.     (void) panel_create_item(panel, PANEL_BUTTON,
  299.     PANEL_ATTRIBUTE_LIST,         button_args,
  300.     PANEL_SHOW_ITEM,        FALSE,
  301.     PANEL_LABEL_IMAGE,
  302.         panel_button_image(panel, "Abort", 5, mush_font),
  303.     PANEL_NOTIFY_PROC,         abort_mail,
  304.     NULL);
  305.  
  306.     (void) panel_create_item(panel, PANEL_CHOICE,
  307.     PANEL_ATTRIBUTE_LIST,         choice_args,
  308.     PANEL_SHOW_ITEM,         FALSE,
  309.     PANEL_LABEL_IMAGE,
  310.         panel_button_image(panel, "Include", 7, mush_font),
  311.     PANEL_CHOICE_STRINGS,         "Include Message",
  312.                     "Forward Message",
  313.                     "Help", NULL,
  314.     PANEL_NOTIFY_PROC,         do_include,
  315.     NULL);
  316.  
  317.     edit_item = panel_create_item(panel, PANEL_BUTTON,
  318.     PANEL_ATTRIBUTE_LIST,         button_args,
  319.     PANEL_SHOW_ITEM,         FALSE,
  320.     PANEL_LABEL_IMAGE,
  321.         panel_button_image(panel, "Edit", 4, mush_font),
  322.     PANEL_NOTIFY_PROC,         do_edit,
  323.     NULL);
  324.  
  325.     (void) panel_create_item(panel, PANEL_CHOICE,
  326.     PANEL_ATTRIBUTE_LIST,         choice_args,
  327.     PANEL_SHOW_ITEM,        FALSE,
  328.     PANEL_LABEL_IMAGE,
  329.         panel_button_image(panel, "Headers", 7, mush_font),
  330.     PANEL_CHOICE_STRINGS,    
  331.         "ALL      ~h", "To:      ~t", "Subject: ~s",
  332.         "Cc:      ~c", "Bcc:     ~b", "Fcc:", NULL,
  333.     PANEL_NOTIFY_PROC,        tilde_from_menu,
  334.     NULL);
  335.  
  336.     sign_item = panel_create_item(panel, PANEL_CHOICE,
  337.     PANEL_ATTRIBUTE_LIST,         choice_args,
  338.     PANEL_DISPLAY_LEVEL,        PANEL_ALL,
  339.     PANEL_SHOW_MENU_MARK,        TRUE,
  340.     PANEL_SHOW_ITEM,         FALSE,
  341.     PANEL_LABEL_STRING,        "Autosign:",
  342.     PANEL_CHOICE_STRINGS,        "Off", "On", NULL,
  343.     NULL);
  344.     panel_set_value(sign_item, !!do_set(set_options, "autosign"));
  345.     /* Create a link to avoid global */
  346.     panel_set(send_item, PANEL_CLIENT_DATA, sign_item, NULL);
  347.  
  348.     filename_item = panel_create_item(panel, PANEL_TEXT,
  349.     PANEL_ATTRIBUTE_LIST,         button_args,
  350.     PANEL_SHOW_ITEM,        FALSE,
  351.     PANEL_LABEL_STRING,        "Filename:",
  352.     PANEL_VALUE_DISPLAY_LENGTH,     30,
  353.     PANEL_NOTIFY_STRING,         "\033",
  354.     PANEL_NOTIFY_PROC,         file_dir,
  355.     NULL);
  356.  
  357.     (void) panel_create_item(panel, PANEL_CHOICE,
  358.     PANEL_ATTRIBUTE_LIST,         choice_args,
  359.     PANEL_SHOW_ITEM,        FALSE,
  360.     PANEL_CLIENT_DATA,        filename_item,
  361.     PANEL_LABEL_IMAGE,
  362.         panel_button_image(panel, "Import", 6, mush_font),
  363.     PANEL_CHOICE_STRINGS,        "Insert", "Replace", NULL,
  364.     PANEL_NOTIFY_PROC,        load_from_file,
  365.     NULL);
  366.  
  367.     (void) panel_create_item(panel, PANEL_BUTTON,
  368.     PANEL_ATTRIBUTE_LIST,         button_args,
  369.     PANEL_SHOW_ITEM,        FALSE,
  370.     PANEL_CLIENT_DATA,        filename_item,
  371.     PANEL_LABEL_IMAGE,
  372.         panel_button_image(panel, "Export", 6, mush_font),
  373.     PANEL_NOTIFY_PROC,        save_to_file,
  374.     NULL);
  375.  
  376.     fortune_item = panel_create_item(panel, PANEL_CHOICE,
  377.     PANEL_ATTRIBUTE_LIST,         choice_args,
  378.     PANEL_DISPLAY_LEVEL,        PANEL_ALL,
  379.     PANEL_SHOW_MENU_MARK,        TRUE,
  380.     PANEL_SHOW_ITEM,         FALSE,
  381.     PANEL_LABEL_STRING,        "Fortune:",
  382.     PANEL_CHOICE_STRINGS,        "Off", "On", NULL,
  383.     NULL);
  384.     panel_set_value(fortune_item, !!do_set(set_options, "fortune"));
  385.     /* Create a link to avoid global */
  386.     panel_set(sign_item, PANEL_CLIENT_DATA, fortune_item, NULL);
  387.  
  388.     window_fit_height(panel);
  389.     return panel;
  390. }
  391.  
  392. #include "glob.h"
  393.  
  394. #ifdef WALK_MENUS
  395. folder_menu_notify(menu, mi)
  396. Menu menu;
  397. Menu_item mi;
  398. {
  399. }
  400.  
  401. static Menu_item
  402. add_path_to_menu(menu, path)
  403. Menu menu;
  404. char *path;
  405. {
  406.     DIR            *dirp;
  407.     struct dirent    *dp;
  408.     struct stat     s_buf;
  409.     Menu_item        mi;
  410.     Menu        next_menu;
  411.     char        buf[MAXPATHLEN];
  412.  
  413.     /* don't add a folder to the list if user can't read it */
  414.     if (stat(path, &s_buf) == -1 || !(s_buf.st_mode & S_IREAD))
  415.     return NULL;
  416.     if ((s_buf.st_mode & S_IFMT) == S_IFDIR) {
  417.     int cnt = 0;
  418.     if (!(dirp = opendir(path)))
  419.         return NULL; /* don't bother adding to list if we can't scan it */
  420.     next_menu = menu_create(MENU_NOTIFY_PROC, folder_menu_notify, NULL);
  421.     while (dp = readdir(dirp))
  422.         if (strcmp(dp->d_name, ".") && strcmp(dp->d_name, ".."))
  423.         if (mi = add_path_to_menu(next_menu,
  424.             sprintf(buf, "%s/%s", path, dp->d_name))) {
  425.             menu_set(next_menu, MENU_APPEND_ITEM, mi, NULL);
  426.             cnt++;
  427.         }
  428.     closedir(dirp);
  429.     mi = menu_create_item(MENU_STRING, trim_filename(path), NULL);
  430.     if (!cnt) {
  431.         menu_destroy(next_menu);
  432.         menu_set(mi, MENU_INACTIVE, TRUE, NULL);
  433.     } else
  434.         menu_set(mi, MENU_PULLRIGHT, next_menu, NULL);
  435.     return mi;
  436.     }
  437.     /* we should check that this file is actually a folder */
  438.     return menu_create_item(MENU_STRING, trim_filename(path), NULL);
  439. }
  440. #endif /* WALK_MENUS */
  441.  
  442. static
  443. add_path_to_menu(item, path, n)
  444. Panel_item item;
  445. char *path;
  446. int *n;
  447. {
  448.     char        **names, **np;
  449.     struct stat     s_buf;
  450.     char        buf[MAXPATHLEN];
  451.  
  452.     /* don't add a folder to the list if user can't read it */
  453.     if (stat(path, &s_buf) == -1 || !(s_buf.st_mode & S_IREAD))
  454.     return;
  455.     if ((s_buf.st_mode & S_IFMT) == S_IFDIR) {
  456.     sprintf(buf, "%s/{.*,*}", path);
  457.     if (filexp(buf, &names) > 0) {
  458.         for (np = names; np && *np; np++) {
  459.         if (!glob(*np, "*/{.,..}"))
  460.             add_path_to_menu(item, *np, n);
  461.         }
  462.         free_vec(names);
  463.     }
  464.     } else if (test_folder(path, NULL))
  465.     panel_set(item,
  466.         PANEL_CHOICE_STRING, (*n)++, savestr(trim_filename(path)),
  467.         NULL);
  468. }
  469.  
  470. /*
  471.  * Open the user's mail folder (either user set or default path) and find all
  472.  * the files (assumed to be mail folders) and add them to the menu list of
  473.  * folders to use.
  474.  */
  475. add_folder_to_menu(item, n)
  476. Panel_item item;
  477. {
  478.     char    *tmp = NULL, *p;
  479. #ifdef WALK_MENUS
  480.     Menu_item    mi;
  481. #endif /* WALK_MENUS */
  482.  
  483.     if (!(p = do_set(set_options, "folder")) || !*p)
  484.     p = DEF_FOLDER;
  485.     if (p) {
  486.     int x = 0;
  487.     tmp = getpath(p, &x);
  488.     if (x == -1) {
  489.         if (errno != ENOENT)
  490.         print("%s: %s\n", p, tmp);
  491.         tmp = NULL;
  492.     }
  493.     }
  494.     if (tmp) {
  495. #ifdef WALK_MENUS
  496.     mi = add_path_to_menu(menu, tmp);
  497. #else /* WALK_MENUS */
  498.     add_path_to_menu(item, tmp, &n);
  499. #endif /* WALK_MENUS */
  500.     }
  501. }
  502.